# -*- coding: utf-8 -*-
"""
Create Time: 2019/11/9 11:43
Author: yxl
Descript:
"""

from django.utils.deprecation import MiddlewareMixin
from index.models import MXUser

class MyMiddleware(MiddlewareMixin):
    def process_request(self, request):

        if request.session.get('username'):
            user = MXUser.objects.get(username=request.session.get('username'))
            request.user = user
        else:
            request.user = ''


